//
//  QYXPageViewController.m
//  OpenYourEyes
//
//  Created by dllo on 16/6/6.
//  Copyright © 2016年 Google AdWords. All rights reserved.
//

#import "QYXPageViewController.h"
#import "AppDelegate.h"
@interface QYXPageViewController ()

//箭头旋转:
@property (nonatomic, strong) UIImageView *topArrowImageView;

@end

@implementation QYXPageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth / 4, 44)];
    titleLabel.text = @"Eyepelizer";
    titleLabel.textAlignment = 1;
    titleLabel.font = [UIFont fontWithName:@"Lobster 1.4" size:25];
    self.navigationItem.titleView = titleLabel;
    
    
    self.topArrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"subfield"]];
    UIView *arrowView = [[UIView alloc] initWithFrame:CGRectMake(38, 26, 16, 16)];
    [arrowView addSubview:_topArrowImageView];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:arrowView];
    
    self.topArrowImageView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer  alloc] initWithTarget:self action:@selector(arrowTuringAction)];
    [self.topArrowImageView addGestureRecognizer:tapGesture];
    
    

}

- (void)arrowTuringAction
{
 
    [UIView animateWithDuration:0.3 animations:^{
        
        self.topArrowImageView.transform = CGAffineTransformRotate(self.topArrowImageView.transform, M_PI / 2);
    } completion:^(BOOL finished) {

    }];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
